package othello.core;

import java.util.List;
import java.util.ArrayList;

public class RandomPutPlayer extends AbstractOthelloPlayer{
    public RandomPutPlayer(){
        name = "ランダムプレイ";
    }

    public NextHandInfo nextHand(Board board){
        NextHandInfo nextHand = new NextHandInfo();

        List<CellPoint> canPutList = getCanPutList(board);

        if(canPutList.size() == 0)
            nextHand.pass();
        else{
            //石を置ける全ての位置からランダムで位置を選ぶ
            int index = (int)(System.currentTimeMillis() % canPutList.size());
            CellPoint point = canPutList.get(index);

            nextHand.setX(point.getX());
            nextHand.setY(point.getY());
        }

        try{
            //考えてるふりをする時間
            Thread.sleep(400);
        }catch(Exception e){
        
        }

        return nextHand;
    }
}